<?php
/**
 * Created by PhpStorm.
 * User: wangc
 * Date: 2016/7/9
 * Time: 17:36
 */
namespace App\Http\Controllers\Home;
use App\Http\Model\Order;
use Illuminate\Http\Request;
use App\Http\Requests;
use Illuminate\Support\Facades\DB;
use Illuminate\Support\Facades\Input;

class orderController extends CommonController{
    public function index(){
        $inp = Input::except("_token");
        $borrow_time = strtotime($inp["time"]);
        $return_method = $borrow_time+3600*24*3;
        $data = [
            "car_id"=>$inp["cid"],
            "borrow_menid" =>$inp["borrow_menid"],
            "return_menid"=>$inp["return_menid"],
            "borrow_time" =>$borrow_time,
            "return_time" =>$return_method,
            "borrow_method"=>"",
            "return_method"=>"",
            "zc_days"=>3,
            "userid"=>"",
            "order_status"=>0,
            "order_price"=>$inp["price"],
            "orderId"=>session("oid"),
        ];
        Order::create($data);
        $status =1;
        return $status;
    }
}